package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbSellerMapper;
import com.dongdongshop.pojo.TbSeller;
import com.dongdongshop.pojo.TbSellerExample;
import com.dongdongshop.service.SellerLoginService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class SellerLoginServiceImpl implements SellerLoginService {

    @Resource
    private TbSellerMapper sellerMapper;

    //跟据用户名称查询用户
    @Override
    public TbSeller getSellerList(String username) {
        TbSellerExample example = new TbSellerExample();
        TbSellerExample.Criteria criteria = example.createCriteria();
        criteria.andSellerIdEqualTo(username);
        List<TbSeller> tbSellers = sellerMapper.selectByExample(example);
        if (tbSellers.size() > 0) {
            return tbSellers.get(0);
        }
        return null;
    }
}
